﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:Coding4Fun.Phone.Controls.Toolkit" 
    xmlns:primitives="clr-namespace:Coding4Fun.Phone.Controls.Toolkit.Primitives">
    <Style TargetType="controls:TimeSpanPicker">
        <Setter Property="Background" Value="{StaticResource PhoneTextBoxBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneTextBoxForegroundBrush}"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="PickerPageUri" Value="/Coding4Fun.Phone.Controls.Toolkit;component/TimeSpanPicker/TimeSpanPickerPage.xaml"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:TimeSpanPicker">
                    <StackPanel>
                        <ContentControl
                            Content="{TemplateBinding Header}"
                            ContentTemplate="{TemplateBinding HeaderTemplate}"
                            Foreground="{StaticResource PhoneSubtleBrush}"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                            Margin="12,0,12,-4"/>
                        <Button
                            x:Name="ValueButton"
                            Content="{TemplateBinding ValueString}"
                            Background="{TemplateBinding Background}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            FontFamily="{TemplateBinding FontFamily}"
                            Foreground="{TemplateBinding Foreground}"
                            Height="72"
                            HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="primitives:LoopingSelector">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <!--<Border Background="Transparent">-->
                        <Canvas x:Name="ItemsPanel">
                            <Canvas.RenderTransform>
                                <TransformGroup>
                                    <TranslateTransform x:Name="CenteringTransform"/>
                                    <TranslateTransform x:Name="PanningTransform"/>
                                </TransformGroup>
                            </Canvas.RenderTransform>
                        </Canvas>
                    <!--</Border>-->
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="primitives:LoopingSelectorItem">
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Padding" Value="6"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border x:Name="root" Opacity="0" CacheMode="BitmapCache" Background="Transparent" Padding="{TemplateBinding Padding}">

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">

                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.2"/>
                                </VisualStateGroup.Transitions>

                                <VisualState x:Name="Normal"/>

                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                                        <DoubleAnimation Storyboard.TargetName="background" Storyboard.TargetProperty="Opacity" To="0" Duration="0"/>
                                        <DoubleAnimation Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="Opacity" To=".6" Duration="0"/>
                                    </Storyboard>
                                </VisualState>

                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="root" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                                        <DoubleAnimation Storyboard.TargetName="background" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                                    </Storyboard>
                                </VisualState>

                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Border.RenderTransform>
                            <TranslateTransform x:Name="Transform"/>
                        </Border.RenderTransform>

						<Grid Margin="{TemplateBinding Margin}">
                            <Rectangle x:Name="background" Margin="2" Opacity="0" Fill="{StaticResource PhoneInactiveBrush}" CacheMode="BitmapCache"/>

							<Border BorderThickness="2" BorderBrush="{StaticResource PhoneInactiveBrush}">
								<ContentPresenter x:Name="contentPresenter" CacheMode="BitmapCache" />
                            </Border>
                        </Grid>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>